﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理员管理</title>
<link rel="stylesheet" type="text/css" href="_ADMIN_css/css.css" />
<script type="text/javascript" src="_ADMIN_js/jquery.min.js"></script>
<!-- <script type="text/javascript" src="js/page.js" ></script> -->
</head>
<style>
	td{
		padding: 10px 0;
	}
	.buttone{
		display: inline-block;
		padding: 1% 1.5%;
		color: white;
		background: #47a4e1;
		border: none;
		border-radius: 4px;
	}
	.paging{
		height:8%;
	}
	.cfD{
		display: inline-block;
	}
	.pagination>li{
		float: left;
		text-align: center;
		border-radius: 5px;
	}
	.pagination>li:hover{
		background-color: #47a4e1;
	}
	.pagination>li:hover>span{
		color: white;
	}
	.pagination>li>a{
		display: inline-block;
		width: 66px;
		line-height: 2rem;
		border-radius: 5px;
		border: 1px solid #CCCCCC;
	}
	.pagination>li>span{
		display: inline-block;
		width: 66px;
		line-height: 2rem;
		color: #47a4e1;
		font-weight: bold;
		font-size: 18px;
	}
	.pagination>li.disabled{
		border-radius: 5px;
		border: 1px solid #CCCCCC;
	}
	.pagination{
		width:auto;
		height: 100%;
		margin: 0 auto;
		float:right;
	}
</style>
<body>
	<div id="pageAll">
		<div class="pageTop">
			<div class="page">
				<img src="_ADMIN_img/coin02.png" /><span><a href="{:url('admin/index/main')}" target="main">首页</a>&nbsp;-&nbsp;</span>
				管理员管理
			</div>
		</div>

		<div class="page">
			<!-- balance页面样式 -->
			<div class="connoisseur">
				<div class="conform">
					<form style="margin-top: 15px">
						<a class="cfD">
							<input class="addUser"  id="selectname" type="text" placeholder="" />
						</a>
						<a class="cfD" href="{:url('admin/admin/namep')}" id="selectbyname">
							<button class="button" style="position: relative; z-index: -1">搜索</button>
						</a>
						<a href="{:url('admin/admin/insert')}" class="cfD">
							<button class="button" style="position: relative; z-index: -1">添加管理员</button>
						</a>
					</form>
				</div>
				<!-- bbalance 表格 显示 -->
				<div class="conShow">
					<table border="1" cellspacing="0" cellpadding="0">
						<tr>
							<td width="66px" class="tdColor tdC">序号</td>
							<td width="255px" class="tdColor">管理员姓名</td>
							<td width="210px" class="tdColor">角色</td>
							<td width="280px" class="tdColor">时间</td>
							<td width="380px" class="tdColor">状态</td>
							<td width="380px" class="tdColor">操作</td>
						</tr>
						{volist name="result" id="vo"}

						<tr>
							<td>{$key+1}</td>
							<td>
								{$vo.user_name}
							</td>
							<td>
								{switch name="$vo.user_r_id"}
									{case value="1"}超级管理{/case}
									{case value="2"}推广部主管{/case}
									{case value="3"}电话部主管{/case}
									{case value="4"}话务员{/case}
									{case value="5"}前台{/case}
									{case value="6"}咨询部主管{/case}
									{case value="7"}咨询人员{/case}
									{case value="8"}预科主管{/case}
									{case value="9"}教务部{/case}
									{case value="10"}项目开发部主管{/case}
									{case value="11"}开发人员{/case}
									{case value="12"}项目设计部主管{/case}
									{case value="13"}设计人员{/case}
									{case value="14"}就业部主管{/case}
									{case value="15"}就业部员工{/case}
									{default /}default
								{/switch}
							</td>
							<td>
								{if condition="!empty($vo.user_createtime)"}
									{$vo.user_createtime|date="Y-m-d H:i:s",###}
								{else /}

								{/if}
							</td>
							<td class="pppppp">
								{if condition="$vo.user_dell == 0"}
									不可用
								{else /}
									可用
								{/if}
							</td>
							<td>
								{if condition="$vo.user_name == $_SESSION['u_name']"}
									<button class="buttone" disabled style="background-color: #CCCCCC">删除</button>
								{else /}
									{if condition="$vo.user_dell == 0"}
										<button class="buttone" onclick="change(this,'{$vo.user_id}','{$vo.user_dell}')">恢复</button>
									{else /}
										<button class="buttone" onclick="change(this,'{$vo.user_id}','{$vo.user_dell}')" >删除</button>
									{/if}
								{/if}

								{if condition="$vo.user_name == $_SESSION['u_name']"}
									<a href="javascript:;" ><button class="buttone" style="position:relative; z-index: -1;background-color: #CCCCCC" disabled>修改</button></a>
									<a href="javascript:;"><button class="buttone" style="position:relative; z-index: -1;background-color: #CCCCCC" disabled>重置密码</button></a>
								{else /}
									<a href="{:url('admin/admin/update',['id'=>$vo.user_id])}"><button class="buttone" style="position:relative; z-index: -1">修改</button></a>
									<a href="" onclick="resetpass(this)"><button class="buttone" style="position:relative; z-index: -1">重置密码</button></a>
								{/if}
							</td>
						</tr>
						{/volist}
					</table>
					<div class="paging">
						{$result->render()}
					</div>
				</div>
				<!-- balance 表格 显示 end-->
			</div>
			<!-- balance页面样式end -->
		</div>

	</div>

</body>

	<script>
		function resetpass(a){
			if(confirm("确定重置密码？重置后密码为:z123456")){
				$(a).attr("href","{:url('admin/admin/reset',['id'=>$vo.user_id])}")
			}
		}
		$("#selectname").change(function(){
			var name=$(this).val();
			$("#selectbyname").attr("href","/admin/admin/namep?name="+name);
		});

		function change(a,b){
			var d=$(a).text();
			if(d=="恢复"){
				$(a).text("删除");
				d=1;
			}else{
				$(a).text("恢复");
				d=0;
			}
			if($(a).parent().parent().children("td.pppppp").html()=="可用"){
				$(a).parent().parent().children("td.pppppp").html("不可用");
			}
			else{
				$(a).parent().parent().children("td.pppppp").html("可用");
			}
			$.post("{:url('admin/admin/delete')}",{"id":b,"dell":d},function(c){
				if(c){
					alert("删除/恢复成功!");
				}
			},'json')
		}
	</script>
</html>